﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommandSavvy;
using CommandRunner.Model;

namespace CommandRunner.Console
{
    public abstract class CommandRunnerConsoleOutput
    {
        private static Object _lock = new Object();

        #region EventHandlers
        internal static void CommandOutput(CommandResult commandResult)
        {
            lock (_lock)
            {
                System.Console.ForegroundColor = ConsoleColor.Green;
                System.Console.WriteLine(commandResult.Command.Execute);
                System.Console.WriteLine(commandResult.Output);
                System.Console.ResetColor();
            }
        }

        internal static void SkippedOutput(CommandResult commandResult)
        {
            lock (_lock)
            {
                System.Console.ForegroundColor = ConsoleColor.Yellow;
                System.Console.WriteLine("Command Skipped: " + commandResult.Command.Execute + "\n");
                System.Console.ResetColor();
            }
        }

        internal static void ErrorOutput(CommandResult commandResult)
        {
            lock (_lock)
            {
                System.Console.ForegroundColor = ConsoleColor.Red;
                System.Console.WriteLine(commandResult.Command.Execute);
                System.Console.WriteLine(commandResult.Output);
                System.Console.ResetColor();
            }
        }
        #endregion EventHandlers
    }
}
